def sol(arr):
    openbr = ['(', '[', '{', '<']
    closebr = [')', ']', '}', '>']
    opposite = {')': '(', ']': '[', '}': '{', '>': '<'}
    stack = []
    for bracket in arr:
        print('===')
        
        if bracket in openbr:
            stack.append(bracket)

        elif bracket in closebr:
            try:
                last = stack[-1]
            except:
                pass
            try:
                opp = opposite[bracket]
            except Exception as e:

                return False
            print('opp', opp)
            print('last', last)
            if opp == last:
                try:
                    del stack[-1]
                except:
                    return False
            else:
                return False
        print('bracket', bracket)
        print('stack', stack)
        
    if len(stack) == 0:
        return True
    return True
lst = '(){}[]'
print(sol(lst))
